<template>
	<view class="wrap form_right">
		<u-form class="form" :model="model" ref="uForm" label-position="left">
			<u-section title="表单信息" sub-title="" :arrow="false" line-color="blue"></u-section>
			<u-form-item label="批次号" prop="batchId" label-width="180"  style="text-align: right;">
				<u-input v-model="model.sendRecord.batchId" type="text" maxlength="64" style="text-align: right;" :disabled="true">{{model.batchId}}</u-input>
				<text style="color: blue;border: 1rpx; border-color: aliceblue; margin-left: 20rpx;" @click="copy(model.batchId)">复制</text>
			</u-form-item>
			<u-form-item label="渠道类型" prop="channelType" label-width="180">
				<js-select v-model="model.sendRecord.channelType" :disabled="true"  dict-type="message_channel_type" itemLabel="dictValue" itemValue="dictKey" ></js-select>
			</u-form-item>
			<u-form-item label="接收号码" prop="receivers" label-width="180" >
				<u-input v-model="seatVar" type="text" maxlength="64" :disabled="true"></u-input>
				{{model.receivers}}
			</u-form-item>
			<u-form-item label="邮件标题" prop="msgContent" label-width="180"  v-if="model.channelType==2">
				<u-input v-model="model.sendRecord.title" type="text" maxlength="64" style="text-align: right;" :disabled="true">{{model.title}}</u-input>
			</u-form-item>
			<u-form-item :label="model.sendRecord.channelType==1?'短信内容':'邮件内容'" prop="msgContent" label-width="180">
				<u-input v-model="seatVar" type="text" maxlength="64" style="text-align: right;" :disabled="true"></u-input>
				{{model.sendRecord.msgContent}}
			</u-form-item>
			<u-form-item label="提交状态" prop="seatVar" label-width="180">
				<u-input v-model="seatVar" type="text" maxlength="64" style="text-align: right;" :disabled="true"></u-input>
				<u-tag v-if="model.sendRecord.status=='2'" text="提交成功" type="success" />
				<u-tag v-else text="提交失败" type="error" />
			</u-form-item>
			<u-form-item label="发送状态" prop="seatVar" label-width="180">
				<u-input v-model="seatVar" type="text" maxlength="64" style="text-align: right;" :disabled="true"></u-input>
				<u-tag v-if="model.sendRecord.sendStatus==='0'" :text="model.sendRecord.sendStatusName" type="success" />
				<u-tag v-else-if="model.sendRecord.sendStatus==='2'" :text="model.sendRecord.sendStatusName" type="warning" />
				<u-tag v-else :text="model.sendRecord.sendStatusName" type="error" />
			</u-form-item>
			<u-form-item label="失败描述" prop="seatVar" label-width="180" v-if="model.resultContent!=null && model.resultContent!=''">
				<u-input v-model="seatVar" type="text" maxlength="64" style="text-align: right;" :disabled="true"></u-input>
				<u-tag :text="model.sendRecord.resultContent" type="error" />
			</u-form-item>
			<u-form-item label="是否回复" prop="seatVar" label-width="180">
				<u-input v-model="seatVar" type="text" maxlength="64" style="text-align: right;" :disabled="true"></u-input>
				<u-tag v-if="model.replyContent!=null && model.replyContent!=''" text="已回复" type="success" />
				<u-tag v-else text="未回复" type="error" />
			</u-form-item>
			<u-form-item label="回复内容" prop="seatVar" label-width="180"  v-if="model.replyContent!='' && model.replyContent!=null" >
				<u-input v-model="seatVar" type="text" maxlength="64" style="text-align: right;" :disabled="true"></u-input>
				<u-tag :text="model.replyContent" type="success" />
			</u-form-item>
			<u-form-item label="发送时间" prop="createTime" label-width="180">
				<u-input v-model="model.sendRecord.createTime" type="text" maxlength="64" style="text-align: right;" :disabled="true"></u-input>
			</u-form-item>
			<u-form-item label="发送人" prop="createUserName" label-width="180">
				<u-input v-model="model.sendRecord.createUserName" type="text" maxlength="64" style="text-align: right;" :disabled="true"></u-input>
			</u-form-item>
		</u-form>
	</view>
</template>
<script>
import {validatenull} from '@/common/validate.js'
export default {
	data() {
		return {
			model: {
				id: '',
				channelType: '',
				receivers:'',
				msgContent: '',
				sendType: '',
				sendDate:'',
				batchId: '',
				templateId: '',
				sendRecord:{},
			},
			seatVar:' ',
			disabled: false
		};
	},
	onLoad(params){
		if (params.id){
			this.$u.api.message.msgReplyRecord.detail({id: params.id}).then(res => {
				Object.assign(this.model, res.data);
				this.model.sendRecord.sendType=res.data.sendRecord.sendType.toString();
				this.model.sendRecord.channelType=res.data.sendRecord.channelType.toString();
				this.model.sendRecord.sendStatus=res.data.sendRecord.sendStatus.toString();
				this.model.sendRecord.statusName=res.data.sendRecord.status==2?"提交成功":"提交失败";
			});
		}
	},
	onReady() {
		
	},
	methods: {
		getStatusName(row){
			if(row.sendStatus===0){
				return "发送成功";
			}else if(row.sendStatus===2){
				return "上游处理中";
			}else{
				return "发送失败";
			}
		},
		copy(batchId){
			uni.setClipboardData({ 
			        data: batchId,
			        success: function () { 
					uni.showToast({
						title:"复制成功",
						duration: 2000
					})
			    }
			})
		},
	}
};
</script>
<style lang="scss" scoped>
.input-placeholder{
	text-align: right;
}
.u-input{
	text-align: right!important;
}
.u-form-item__message{
	text-align: right!important;
}
.uni-textarea-placeholder{
	text-align: left;
}
.u-form-item{
	font-size:30rpx;
}

</style>
